<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" >
      <el-form-item label="姓名" prop="name">
          <el-input
              v-model="queryParams.name"
              placeholder="请输入"
              clearable
              size="small"
              style="width:200px"
          />
      </el-form-item>
      <el-form-item label="性别" prop="sex">
        <el-select v-model="queryParams.sex"
                   style="width: 2.3rem"
                   placeholder="请选择" clearable>
          <el-option
            v-for="item in sexList"
            :key="item.label"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
        <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['oa:employeeInfo:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['oa:employeeInfo:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="获取岗位渠道" align="center" prop="channel" sortable/>
      <el-table-column label="姓名" align="center" prop="name" sortable/>
      <el-table-column label="性别" align="center" prop="sex" sortable/>
      <el-table-column label="婚育状况" align="center" prop="maritalStatus" sortable/>
      <el-table-column label="政治面貌" align="center" prop="politicalOutlook" sortable/>
      <el-table-column label="手机号码" align="center" prop="phone" sortable/>
      <el-table-column label="邮箱" align="center" prop="email" sortable/>
      <el-table-column label="创建时间" align="center" prop="createTime" sortable/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['oa:employeeInfo:edit']"
          >修改</el-button>
          <el-button
            v-if="(scope.row.createBy === userId || userId === 'admin' || userId === 'sysadmin')"
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['oa:employeeInfo:remove']"
          >删除</el-button>

          <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleView(scope.row)"
          >查看</el-button>
          <el-button
              size="mini"
              type="text"
              icon="el-icon-printer"
              @click="openPrintView(scope.row)"
          >打印</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改员工信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :before-close="cancel">
      <el-form ref="form" :model="form" :rules="rules" label-width="1.5rem"  style="overflow: auto;overflow-x:hidden;" inline>
        <div>
          <div style="margin: 10px 10px;border-bottom: 1px solid #eeeeee;line-height: 0.625rem;">
            <i class="el-icon-edit" style="color: #da7937;"></i>
            岗位信息
          </div>
          <el-form-item label="应聘岗位:" prop="position">
            <el-input  v-model="form.position" :disabled='isdisabled' placeholder="请输入"></el-input>
          </el-form-item>
          <el-form-item label="岗位招聘信息渠道:" label-width="1.9rem" prop="channel">
            <el-select v-model="form.channel" :disabled='isdisabled'
                       placeholder="请选择" clearable>
              <el-option
                v-for="item in radioList"
                :key="item.label"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="推荐人姓名:" label-width="1.25rem" prop="referee">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.referee"></el-input>
          </el-form-item>
        </div>
        <div>
          <div style="margin: 10px 10px;border-bottom: 1px solid #eeeeee;line-height: 0.625rem;">
            <i class="el-icon-edit" style="color: #da7937;"></i>
            个人基本信息
          </div>
          <el-form-item label="姓名:"  prop="name">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item label="性别:"  prop="sex">
            <el-select v-model="form.sex"
                       style="width: 2.3rem"
                       :disabled='isdisabled'
                       placeholder="请选择" clearable>
              <el-option
                v-for="item in sexList"
                :key="item.label"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="民族:" prop="nation">
            <el-select v-model="form.nation"
                       style="width: 2.3rem"
                       :disabled='isdisabled'
                       placeholder="请选择" clearable>
              <el-option
                v-for="item in nationList"
                :key="item.label"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="出生年月:"  prop="birthDate" >
            <el-date-picker
              :disabled='isdisabled'
              v-model="form.birthDate"
              type="date"
              style="width: 2.3rem"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="籍贯:" prop="nativePlace" >
            <el-input
              style="width: 2.3rem"
              :disabled='isdisabled'
              v-if="form.nativePlace"
              v-model="form.nativePlace"
              placeholder="请输入项目地点"
            >
              <i
                slot="suffix"
                class="el-icon-close"
                @click="loadMap"
                style="cursor: pointer;"
              ></i>
            </el-input>
            <el-cascader
              v-else
              size="large"
              style="width: 2.3rem"
              :options="options"
              v-model="selectedOptions"
              @change="addressChange"
              clearable
            ></el-cascader>
          </el-form-item>
          <el-form-item label="家庭所在地:" prop="homeLocation">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.homeLocation"></el-input>
          </el-form-item>
          <el-form-item label="身份证号:" prop="idNumber">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.idNumber"></el-input>
          </el-form-item>
          <el-form-item label="婚育状况:" prop="maritalStatus">
            <el-select v-model="form.maritalStatus"
                       style="width: 2.3rem"
                       :disabled='isdisabled'
                       placeholder="请选择" clearable>
              <el-option
                v-for="item in maritalStatusList"
                :key="item.label"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            <!--              <el-input placeholder="请输入" v-model="form.maritalStatus"></el-input>-->
          </el-form-item>
          <el-form-item label="政治面貌:" prop="politicalOutlook">
            <el-select v-model="form.politicalOutlook"
                       style="width: 2.3rem"
                       :disabled='isdisabled'
                       placeholder="请选择" clearable>
              <el-option
                v-for="item in politicalOutlookList"
                :key="item.label"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            <!--              <el-input placeholder="请输入" v-model="form.politicalOutlook"></el-input>-->
          </el-form-item>
          <el-form-item label="身高(cm):" prop="height">
            <el-input placeholder="请输入"
                      :disabled='isdisabled'
                      @input="form.height=form.height.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/,'$1')"
                      v-model="form.height"></el-input>
          </el-form-item>
          <el-form-item label="体重(kg):" prop="weight">
            <el-input placeholder="请输入"
                      :disabled='isdisabled'
                      @input="form.weight=form.weight.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/,'$1')"
                      v-model="form.weight"></el-input>
          </el-form-item>
          <el-form-item label="特长:" prop="speciality">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.speciality"></el-input>
          </el-form-item>
          <el-form-item label="技术职称:" prop="technicalTitle">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.technicalTitle"></el-input>
          </el-form-item>
          <el-form-item label="手机号码:" prop="phone">
            <el-input placeholder="请输入" :disabled='isdisabled'
                      @input="form.phone=form.phone.replace(/^\D*([0-9]\d*)?.*$/,'$1')"
                      v-model="form.phone" maxlength="11"></el-input>
          </el-form-item>
          <el-form-item label="邮箱:" prop="email">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.email"></el-input>
          </el-form-item>
          <div>
            <el-form-item label="身份证地址(详细):" prop="address" label-width="2.125rem" style="width: 100%" class="mailAddress">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.address"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="通讯地址(详细住址):" prop="mailAddress" style="width: 100%" label-width="2.125rem" class="mailAddress">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.mailAddress"></el-input>
            </el-form-item>
          </div>
          <el-form-item label="紧急联系人姓名:" prop="emergencyName" label-width="1.625rem">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.emergencyName"></el-input>
          </el-form-item>
          <el-form-item label="紧急联系人关系:" prop="emergencyRelation" label-width="1.625rem">
            <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.emergencyRelation"></el-input>
          </el-form-item>
          <el-form-item label="紧急联系人电话:" prop="emergencyPhone" label-width="1.625rem">
            <el-input placeholder="请输入"
                      :disabled='isdisabled'
                      @input="form.emergencyPhone=form.emergencyPhone.replace(/^\D*([0-9]\d*)?.*$/,'$1')"
                      v-model="form.emergencyPhone" maxlength="11"></el-input>
          </el-form-item>
        </div>
        <div>
          <div style="margin: 10px 10px;border-bottom: 1px solid #eeeeee;line-height: 0.625rem;">
            <i class="el-icon-edit" style="color: #da7937;"></i>
            教育情况:
          </div>
          <el-form-item label="教育清单:" label-width="1.125rem">
            <el-button
              type="primary"
              :disabled='isdisabled'
              icon="el-icon-plus"
              size="mini"
              @click="applyAddRow(educationList)"
            >添加教育经历</el-button>
          </el-form-item>
          <el-table
            ref="table"
            :data="educationList"
            style="width: 100%;margin-bottom:0.125rem"
            border
          >
            <el-table-column label="序号" align="center" width="55" prop="xh" type="index"></el-table-column>
            <el-table-column prop="submitDateList" label="起讫时间" align="center" width="330">
              <template slot-scope="scope">
                <el-date-picker
                  :disabled='isdisabled'
                  v-model="scope.row.submitDateList"
                  type="monthrange"
                  range-separator="至"
                  start-placeholder="开始月份"
                  end-placeholder="结束月份">
                </el-date-picker>
                <!--                  <el-input v-model="scope.row.itemName"></el-input>-->
              </template>
            </el-table-column>
            <el-table-column prop="school" label="学校" align="center" width="180">
              <template slot-scope="scope">
                <el-input :disabled='isdisabled' v-model="scope.row.school" ></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="major" label="专业" align="center" width="180">
              <template slot-scope="scope">
                <el-input :disabled='isdisabled' v-model="scope.row.major"></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="qualification" label="学历" align="center" width="180">
              <template slot-scope="scope">
                <el-input
                  :disabled='isdisabled'
                  v-model="scope.row.qualification"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="educationForm" label="学历形式" align="center" width="350">
              <template slot-scope="scope">
                <el-select v-model="scope.row.educationForm"
                           style="width: 2.875rem;"
                           :disabled='isdisabled'
                           placeholder="请选择" clearable>
                  <el-option
                    v-for="item in educationFormList"
                    :key="item.label"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  size="small"
                  :disabled='isdisabled'
                  @click.native.prevent="applyDeleteRow(scope.$index, educationList)"
                >移除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-form-item label="上传学历附件:" style="width: 100%" prop="educationAttachmnet">
            <fileUpload
              :isDisabled='isdisabled'
              v-model="form.educationAttachmnet"
              style="width: 280px;"
              :limit="5"
            />
          </el-form-item>
        </div>
        <div>
          <div style="margin: 10px 10px;border-bottom: 1px solid #eeeeee;line-height: 0.625rem;">
            <i class="el-icon-edit" style="color: #da7937;"></i>
            工作经历:
          </div>
          <el-form-item label="工作经历清单:" label-width="1.375rem">
            <el-button
              type="primary"
              :disabled='isdisabled'
              icon="el-icon-plus"
              size="mini"
              @click="jobAddRow(jobList)"
            >添加工作经历</el-button>
          </el-form-item>
          <el-table
            ref="table"
            :data="jobList"
            style="width: 100%;margin-bottom:0.125rem"
            border
          >
            <el-table-column label="序号" align="center" width="55" prop="xh" type="index"></el-table-column>
            <el-table-column prop="submitDateList" label="起讫时间" align="center" width="330">
              <template slot-scope="scope">
                <el-date-picker
                  :disabled='isdisabled'
                  v-model="scope.row.submitDateList"
                  type="monthrange"
                  range-separator="至"
                  start-placeholder="开始月份"
                  end-placeholder="结束月份">
                </el-date-picker>
              </template>
            </el-table-column>
            <el-table-column prop="unit" label="工作单位" align="center" width="180">
              <template slot-scope="scope">
                <el-input v-model="scope.row.unit" :disabled='isdisabled'></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="position" label="所任职务" align="center" width="180">
              <template slot-scope="scope">
                <el-input v-model="scope.row.position" :disabled='isdisabled'></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="salary" label="税前年度综合收入(元)" align="center" width="180">
              <template slot-scope="scope">
                <el-input
                  :disabled='isdisabled'
                  @input="scope.row.salary=scope.row.salary.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/,'$1')"
                  v-model="scope.row.salary"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="certifier" label="证明人及职务" align="center" width="230">
              <template slot-scope="scope">
                <el-input
                  :disabled='isdisabled'
                  v-model="scope.row.certifier"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column prop="phone" label="证明人电话" align="center" width="230" >
              <template slot-scope="scope">
                <el-input
                  maxlength="11"
                  :disabled='isdisabled'
                  v-model="scope.row.phone"
                  @input="scope.row.phone=scope.row.phone.replace(/^\D*([0-9]\d*)?.*$/,'$1')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  :disabled='isdisabled'
                  @click.native.prevent="applyDeleteRow(scope.$index, jobList)"
                  size="small"
                >移除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div>
          <div style="margin: 10px 10px;border-bottom: 1px solid #eeeeee;line-height: 0.625rem;">
            <i class="el-icon-edit" style="color: #da7937;"></i>
            其他情况说明
          </div>
          <div>
            <el-form-item label="是否有犯罪记录:" label-width="2.25rem" prop="isCrime">
              <el-select v-model="form.isCrime"
                         :disabled='isdisabled'
                         @change="isCrimeChange"
                         placeholder="请选择" clearable>
                <el-option
                  v-for="item in isExperienceList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="请说明:" v-if="form.isCrime=='是'" label-width="1rem" prop="crimeExperience">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.crimeExperience"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="是否有违规违纪记录:" label-width="2.25rem" prop="isViolation">
              <el-select v-model="form.isViolation"
                         @change="violationChange"
                         :disabled='isdisabled'
                         placeholder="请选择" clearable>
                <el-option
                  v-for="item in isExperienceList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="请说明:" v-if="form.isViolation=='是'" label-width="1rem" prop="violationExperience">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.violationExperience"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="曾否因大病入院或患有特殊疾病:" label-width="3.125rem" prop="isHospital">
              <el-select v-model="form.isHospital"
                         @change="hospitalChange"
                         :disabled='isdisabled'
                         placeholder="请选择" clearable>
                <el-option
                  v-for="item in isExperienceList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="请说明:" v-if="form.isHospital=='是'" label-width="1rem" prop="hospitalExperience">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.hospitalExperience"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="是否对其他公司负竞业限制义务:" label-width="3.125rem" prop="isLimit">
              <el-select v-model="form.isLimit"
                         @change="limitChange"
                         :disabled='isdisabled'
                         placeholder="请选择" clearable>
                <el-option
                  v-for="item in isExperienceList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="请说明:" v-if="form.isLimit=='是'" label-width="1rem" prop="limitExperience">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.limitExperience"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="是否曾在本集团及所属分子公司任职或建立过劳动关系:" label-width="4.875rem" prop="isEntry">
              <el-select v-model="form.isEntry"
                         @change="entryChange"
                         :disabled='isdisabled'
                         placeholder="请选择" clearable>
                <el-option
                  v-for="item in isExperienceList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="请说明:" v-if="form.isEntry=='是'" label-width="1rem" prop="entryExperience">
              <el-input placeholder="请输入" :disabled='isdisabled' v-model="form.entryExperience"></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item class="mailAddress" label="其他补充说明：" label-width="1.75rem" prop="otherExperience" style="width: 100%">
              <el-input style="width: 100%" v-model="form.otherExperience" :disabled='isdisabled' type="textarea" placeholder="请输入"/>
            </el-form-item>
          </div>
        </div>
        <div style="float:right" v-if="flag">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm('submit')">提交</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </el-form>
    </el-dialog>
    <printForm
      ref="printForm"
      form-type="员工信息表"
      :form="form"
    ></printForm>
  </div>
</template>

<script>
import printForm from "./printForm.vue";
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/oa/employeeInfo";
import {parseTime} from "@/utils/ruoyi";
import {CodeToText, regionData} from "element-china-area-data";
export default {
  name: "Info",
  components: {
    printForm
  },
  data() {
    return {
      projectNameList: [],
      isdisabled:false,
      // 流程实例
      processInstanceId: '',
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      options: regionData,
      selectedOptions: [],
      // 员工信息表格数据
      infoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        submitTimeList: [],
        createBy:'',
        status:'',
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        position: [
          { required: true, message: "应聘岗位不能为空", trigger: "blur" }
        ],
        channel: [
          { required: true, message: "获取岗位渠道不能为空", trigger: "blur" }
        ],
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        sex: [
          { required: true, message: "性别不能为空", trigger: "change" }
        ],
        birthDate: [
          { required: true, message: "出生年月不能为空", trigger: "blur" }
        ],
        nation: [
          { required: true, message: "民族不能为空", trigger: "blur" }
        ],
        nativePlace: [
          { required: true, message: "籍贯不能为空", trigger: "blur" }
        ],
        homeLocation: [
          { required: true, message: "家庭所在地不能为空", trigger: "blur" }
        ],
        idNumber: [
          { required: true, message: "身份证号不能为空", trigger: "blur" }
        ],
        maritalStatus: [
          { required: true, message: "婚育状况不能为空", trigger: "blur" }
        ],
        politicalOutlook: [
          { required: true, message: "政治面貌不能为空", trigger: "blur" }
        ],
        technicalTitle: [
          { required: true, message: "技术职称不能为空", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "手机号码不能为空", trigger: "blur" }
        ],
        email: [
          { required: true, message: "邮箱不能为空", trigger: "blur" }
        ],
        address: [
          { required: true, message: "身份证地址不能为空", trigger: "blur" }
        ],
        mailAddress: [
          { required: true, message: "通讯地址不能为空", trigger: "blur" }
        ],
        emergencyName: [
          { required: true, message: "紧急联系人姓名不能为空", trigger: "blur" }
        ],
        emergencyRelation: [
          { required: true, message: "紧急联系人关系不能为空", trigger: "blur" }
        ],
        emergencyPhone: [
          { required: true, message: "紧急联系人电话不能为空", trigger: "blur" }
        ],
        educationalExperience: [
          { required: true, message: "教育经历不能为空", trigger: "blur" }
        ],
        workExperience: [
          { required: true, message: "工作经历不能为空", trigger: "blur" }
        ],
        isCrime: [
          { required: true, message: "是否犯罪不能为空", trigger: "blur" }
        ],
        isViolation: [
          { required: true, message: "是否违纪不能为空", trigger: "blur" }
        ],
        isHospital: [
          { required: true, message: "是否入院不能为空", trigger: "blur" }
        ],
        isEntry: [
          { required: true, message: "是否曾经入职不能为空", trigger: "blur" }
        ],
      },
      taskVariables: {}, //流程变量
      taskId: undefined, //任务id
      flag: true,
      // 消息提醒
      sendMessage: {},
      userId:'',
      nationList: [
        {
          id: 1,
          label: "汉族",
          value: "汉族",
        },
        {
          id: 2,
          label: "壮族",
          value: "壮族",
        },
        {
          id: 3,
          label: "满族",
          value: "满族",
        },
        {
          id: 4,
          label: "回族",
          value: "回族",
        },
        {
          id: 5,
          label: "苗族",
          value: "苗族",
        },
        {
          id: 6,
          label: "维吾尔族",
          value: "维吾尔族",
        },
        {
          id: 7,
          label: "土家族",
          value: "土家族",
        },
        {
          id: 8,
          label: "彝族",
          value: "彝族",
        },
        {
          id: 9,
          label: "蒙古族",
          value: "蒙古族",
        },
        {
          id: 10,
          label: "藏族",
          value: "藏族",
        },
        {
          id: 11,
          label: "布依族",
          value: "布依族",
        },
        {
          id: 12,
          label: "侗族",
          value: "侗族",
        },
        {
          id: 13,
          label: "瑶族",
          value: "瑶族",
        },
        {
          id: 14,
          label: "朝鲜族",
          value: "朝鲜族",
        },
        {
          id: 15,
          label: "白族",
          value: "白族",
        },
        {
          id: 16,
          label: "哈尼族",
          value: "哈尼族",
        },
        {
          id: 17,
          label: "哈萨克族",
          value: "哈萨克族",
        },
        {
          id: 18,
          label: "黎族",
          value: "黎族",
        },
        {
          id: 19,
          label: "傣族",
          value: "傣族",
        },
        {
          id: 20,
          label: "畲族",
          value: "畲族",
        },
        {
          id: 21,
          label: "傈僳族",
          value: "傈僳族",
        },
        {
          id: 22,
          label: "仡佬族",
          value: "仡佬族",
        },
        {
          id: 23,
          label: "东乡族",
          value: "东乡族",
        },
        {
          id: 24,
          label: "高山族",
          value: "高山族",
        },
        {
          id: 25,
          label: "拉祜族",
          value: "拉祜族",
        },
        {
          id: 26,
          label: "水族",
          value: "水族",
        },
        {
          id: 27,
          label: "佤族",
          value: "佤族",
        },
        {
          id: 28,
          label: "纳西族",
          value: "纳西族",
        },
        {
          id: 29,
          label: "羌族",
          value: "羌族",
        },
        {
          id: 30,
          label: "土族",
          value: "土族",
        },
        {
          id: 31,
          label: "仫佬族",
          value: "仫佬族",
        },
        {
          id: 32,
          label: "锡伯族",
          value: 32,
        },
        {
          id: 33,
          label: "柯尔克孜族",
          value: "柯尔克孜族",
        },
        {
          id: 34,
          label: "达斡尔族",
          value: "达斡尔族",
        },
        {
          id: 35,
          label: "景颇族",
          value: "景颇族",
        },
        {
          id: 36,
          label: "毛南族",
          value: "毛南族",
        },
        {
          id: 37,
          label: "撒拉族",
          value: "撒拉族",
        },
        {
          id: 38,
          label: "布朗族",
          value: "布朗族",
        },
        {
          id: 39,
          label: "塔吉克族",
          value: "塔吉克族",
        },
        {
          id: 40,
          label: "阿昌族",
          value: "阿昌族",
        },
        {
          id: 41,
          label: "普米族",
          value: "普米族",
        },
        {
          id: 42,
          label: "鄂温克族",
          value: "鄂温克族",
        },
        {
          id: 43,
          label: "怒族",
          value: "怒族",
        },
        {
          id: 44,
          label: "京族",
          value: "京族",
        },
        {
          id: 45,
          label: "基诺族",
          value: "基诺族",
        },
        {
          id: 46,
          label: "德昂族",
          value: "德昂族",
        },
        {
          id: 47,
          label: "保安族",
          value: "保安族",
        },
        {
          id: 48,
          label: "俄罗斯族",
          value: "俄罗斯族",
        },
        {
          id: 49,
          label: "裕固族",
          value: "裕固族",
        },
        {
          id: 50,
          label: "乌孜别克族",
          value: "乌孜别克族",
        },
        {
          id: 51,
          label: "门巴族",
          value: "门巴族",
        },
        {
          id: 52,
          label: "鄂伦春族",
          value: "鄂伦春族",
        },
        {
          id: 53,
          label: "独龙族",
          value: "独龙族",
        },
        {
          id: 54,
          label: "塔塔尔族",
          value: "塔塔尔族",
        },
        {
          id: 55,
          label: "赫哲族",
          value: "赫哲族",
        },
        {
          id: 56,
          label: "珞巴族",
          value: "珞巴族",
        },
      ],
      maritalStatusList:[
        {
          label:"未婚未孕",
          value:"未婚未孕"
        },{
          label:"未婚已孕",
          value:"未婚已孕"
        },{
          label:"已婚未孕",
          value:"已婚未孕"
        },{
          label:"已婚已孕",
          value:"已婚已孕"
        },{
          label:"离异未孕",
          value:"离异未孕"
        },{
          label:"离异已孕",
          value:"离异已孕"
        },{
          label:"丧偶未孕",
          value:"丧偶未孕"
        },{
          label:"丧偶已孕",
          value:"丧偶已孕"
        }],
      politicalOutlookList:[
        {
          label:"中共党员",
          value:"中共党员"
        },
        {
          label:"中共预备党员",
          value:"中共预备党员"
        },
        {
          label:"共青团员",
          value:"共青团员"
        },
        {
          label:"民革党员",
          value:"民革党员"
        },
        {
          label:"民盟盟员",
          value:"民盟盟员"
        },
        {
          label:"民建会员",
          value:"民建会员"
        },
        {
          label:"民进会员",
          value:"民进会员"
        },
        {
          label:"农工党党员",
          value:"农工党党员"
        },
        {
          label:"致公党党员",
          value:"致公党党员"
        },
        {
          label:"九三学社社员",
          value:"九三学社社员"
        },
        {
          label:"台盟盟员",
          value:"台盟盟员"
        },
        {
          label:"无党派人",
          value:"无党派人"
        },
        {
          label:"群众",
          value:"群众"
        }
      ],
      isExperienceList:[
        {
          label:"否",
          value:"否"
        },
        {
          label:"是",
          value:"是"
        }
      ],
      educationList:[{}],
      jobList:[{}],
      radioList:[
        {
          label:"猎头",
          value:"猎头",
        },{
          label:"网站",
          value:"网站",
        },{
          label:"内部推荐",
          value:"内部推荐",
        },],
      sexList:[
        {
          label:"男",
          value:"男",
        },{
          label:"女",
          value:"女",
        }
      ],
      educationFormList:[
        {
          label:"统招本科及以上",
          value:"统招本科及以上",
        },
        {
          label:"统招专科",
          value:"统招专科",
        },
        {
          label:"非统招（成教/自考/网络教育）",
          value:"非统招（成教/自考/网络教育）",
        }
      ],
    };
  },
  created() {
    this.getList();
  },
  mounted() {
      this.$nextTick(() => {
        this.userId=this.$store.state.user.name;
      },300)
  },
  methods: {
    async openPrintView(row) {
      const { data } = await getInfo(row.id);
      this.form = data;
      this.$refs.printForm.open();
    },
    /** 查询员工信息列表 */
    getList() {
      this.loading = true;
      listInfo(this.queryParams).then(response => {
        this.infoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.isdisabled=false
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        deptId: undefined,
        userId: undefined,
        position: undefined,
        departureTime: undefined,
        channel: undefined,
        referee: undefined,
        name: undefined,
        sex: undefined,
        birthDate: undefined,
        nation: undefined,
        nativePlace: undefined,
        homeLocation: undefined,
        idNumber: undefined,
        maritalStatus: undefined,
        politicalOutlook: undefined,
        technicalTitle: undefined,
        phone: undefined,
        email: undefined,
        address: undefined,
        mailAddress: undefined,
        emergencyName: undefined,
        emergencyRelation: undefined,
        emergencyPhone: undefined,
        educationalExperience: undefined,
        workExperience: undefined,
        isCrime: undefined,
        crimeExperience: undefined,
        isViolation: undefined,
        violationExperience: undefined,
        isHospital: undefined,
        hospitalExperience: undefined,
        isEntry: undefined,
        entryExperience: undefined,
        otherExperience: undefined,
        createBy: undefined,
        updateBy: undefined,
        createTime: undefined,
        updateTime: undefined
      };
      this.processInstanceId = undefined
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
       this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length

    },
    /** 新增按钮操作 */
    handleAdd() {
      this.flag = true
      this.reset();
      this.open = true;
      this.title = "添加员工信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.flag = true
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getInfo(id).then(response => {
        this.educationList=JSON.parse(response.data.educationalExperience);
        this.jobList=JSON.parse(response.data.workExperience);
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改员工信息";
        this.sendMessage = {
            title:'员工信息',
            messageContent:'单据【'+row.id+"】申请"
        }
      });
    },
    //查看
    handleView(row){
        this.flag = false
        this.loading = true;
        this.reset();
        const id = row.id || this.ids
        getInfo(id).then(response => {
            this.educationList=JSON.parse(response.data.educationalExperience);
            this.jobList=JSON.parse(response.data.workExperience);
            this.loading = false;
            this.form = response.data;
            this.isdisabled=true
            this.open = true;
            this.title = "查看员工信息业务";
        });
    },
    /** 提交按钮 */
    submitForm(flag) {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          this.form.educationalExperience=JSON.stringify(this.educationList);
          this.form.workExperience=JSON.stringify(this.jobList);
          if (this.form.id != null) {
            updateInfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addInfo(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.cancel();
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除员工信息编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delInfo(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('oa/info/export', {
        ...this.queryParams
      }, `info_${new Date().getTime()}.xlsx`)
    },
    addressChange(arr) {
      this.form.nativePlace =
        CodeToText[arr[0]] +
        "->" +
        CodeToText[arr[1]] +
        "->" +
        CodeToText[arr[2]];
      this.selectedOptions = [];
    },
    loadMap() {
      this.form.nativePlace = "";
      this.selectedOptions = [];
    },
    //删除表格里的行(申请状态)
    applyDeleteRow(index, rows) {
      rows.splice(index, 1);
    },
    jobAddRow(tableData){
      tableData.push({
        submitDateList: "",
        unit: "",
        position: "",
        salary: "",
        certifier: "",
        phone: "",
      });
    },
    applyAddRow(tableData){
      tableData.push({
        submitDateList: "",
        number: "",
        school: "",
        major: "",
        qualification: "",
        educationForm: "",
      });
    },
    isCrimeChange(){
      this.form.crimeExperience=undefined;
    },
    violationChange(){
      this.form.violationExperience=undefined;
    },
    hospitalChange(){
      this.form.hospitalExperience=undefined;
    },
    limitChange(){
      this.form.limitExperience=undefined;
    },
    entryChange(){
      this.form.entryExperience=undefined;
    }
  }
};
</script>
<style scoped>
    /* 设置滚动条宽度和高度 */
    ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
        width: 8px; /* 横向滚动条 */
        height: 8px; /* 纵向滚动条 必写 */
    }
    /* 设置滚动条样式 */
    ::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
        background-color: #dde;
        border-radius: 3px;
    }
    #selectForm >>> .el-form-item__label {
        font-size: 12px;
    }
    ::v-deep .bjsm .el-form-item__content{
        width: calc(100% - 130px) !important;
    }
    ::v-deep.mailAddress{
      .el-form-item__content{
        width: 75% !important;
      }
    }

</style>
